home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / Oberon⁄F™ 1.1 / Obx / Docu / Address2 (.txt) < prev    next >
Encoding:
Oberon Document  |  1996-01-05  |  3.8 KB  |  75 lines  |  [oODC/obnF]

  1. Documents.StdDocumentDesc
  2. Documents.DocumentDesc
  3. Containers.ViewDesc
  4. Views.ViewDesc
  5. Stores.StoreDesc
  6. Documents.ModelDesc
  7. Containers.ModelDesc
  8. Models.ModelDesc
  9. Stores.ElemDesc
  10. TextViews.StdViewDesc
  11. TextViews.ViewDesc
  12. TextModels.StdModelDesc
  13. TextModels.ModelDesc
  14. TextModels.AttributesDesc
  15. Helvetica
  16. Helvetica
  17. Helvetica
  18. Helvetica
  19. Helvetica
  20. TextRulers.StdRulerDesc
  21. TextRulers.RulerDesc
  22. TextRulers.StdStyleDesc
  23. TextRulers.StyleDesc
  24. TextRulers.AttributesDesc
  25. Helvetica
  26. MODULE ObxAddress2;
  27.     IMPORT Files, Converters, Views, Dialog, TextModels, TextMappers, TextViews;
  28.         adr*: RECORD (Dialog.Interactor)
  29.             name*:    ARRAY 64 OF CHAR;
  30.             street*:    ARRAY 64 OF CHAR;
  31.             city*:        ARRAY 24 OF CHAR;
  32.             state*:    ARRAY 6 OF CHAR;
  33.             ZIP*:        ARRAY 6 OF CHAR;
  34.             country*:    ARRAY 16 OF CHAR;
  35.             customer:    LONGINT;
  36.             update*:    BOOLEAN;
  37.             Text*:    PROCEDURE
  38.         END;
  39.     PROCEDURE Text;
  40.         VAR loc: Files.Locator; name: Files.Name; conv: Converters.Converter;
  41.             v: Views.View; t: TextModels.Model; f: TextMappers.Formatter;
  42.     BEGIN
  43.         loc := NIL; name := ""; conv := NIL;
  44.         v := Views.Old(Views.ask, loc, name, conv);
  45.         IF (v # NIL) & (v IS TextViews.View) THEN
  46.             t := v(TextViews.View).ThisModel();
  47.             f.ConnectTo(t);
  48.             f.SetPos(t.Length());
  49.             f.WriteString(adr.name); f.WriteTab;
  50.             f.WriteString(adr.street); f.WriteTab;
  51.             f.WriteString(adr.city); f.WriteTab;
  52.             f.WriteString(adr.state); f.WriteTab;
  53.             f.WriteString(adr.ZIP); f.WriteTab;
  54.             f.WriteString(adr.country); f.WriteTab;
  55.             f.WriteInt(adr.customer); f.WriteTab;
  56.             f.WriteBool(adr.update); f.WriteLn;
  57.             Views.OpenView(v);
  58.             adr.name := ""; adr.street := ""; adr.city := ""; adr.state := "";
  59.             adr.ZIP := ""; adr.country := ""; adr.customer := 0; adr.update := FALSE;
  60.             Dialog.Update(adr); Dialog.CheckGuards
  61.         END
  62.     END Text;
  63. BEGIN
  64.     adr.Text := Text
  65. END ObxAddress2.
  66. TextControllers.StdCtrlDesc
  67. TextControllers.ControllerDesc
  68. Containers.ControllerDesc
  69. Controllers.ControllerDesc
  70. Helvetica
  71. Oberon by Example: ObxAddress2
  72. This example combines features of earlier examples: it allows to enter an address via a mask, and a push button causes the entered data to be appended to a text in a file. Afterwards, the entered data is cleared again. In order to be able to notify controls of a change in the displayed data, the interactor must be an extension of a Dialog.Interactor. For this purpose, there is the Dialog.Update procedure which takes an interactor as parameter. After one or possibly several calls to Dialog.Update, procedure Dialog.CheckGuards should be called. This gives the controls the opportunity to evaluate so-called guard procedures, which may enable or disable controls, depending on the new state of the interactor.
  73. Helvetica
  74. Documents.ControllerDesc
  75.